package com.atguigu.jxc.controller;



import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.domain.SuccessCode;
import com.atguigu.jxc.service.CustomerReturnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
@RequestMapping("customerReturnListGoods")
public class CustomerReturnController {

    @Autowired
    CustomerReturnService customerReturnService;

    /**
     * 请求URL：http://localhost:8080/customerReturnListGoods/list
     *     请求参数：String returnNumber, Integer customerId, Integer state, String sTime,String eTime
     *     请求方式：POST
     *     返回值类型：JSON
     *     返回值：Map<String,Object>
     */

    @PostMapping("list")
    public Map<String,Object> list(String returnNumber, Integer customerId, Integer state, String sTime,String eTime){
        return customerReturnService.list(returnNumber,customerId,state,sTime,eTime);
    }


    /**
     * 请求URL：http://localhost:8080/customerReturnListGoods/goodsList
     * 请求参数：Integer customerReturnListId
     * 请求方式：POST
     * 返回值类型：JSON
     * 返回值：Map<String,Object>
     */
    @PostMapping("goodsList")
    public Map<String,Object> goodsList (Integer customerReturnListId){

        return customerReturnService.goodsList(customerReturnListId);
    }

    /**
     * 请求URL：http://localhost:8080/customerReturnListGoods/delete
     * 请求参数：Integer customerReturnListId
     * 请求方式：POST
     * 返回值类型：JSON
     * 返回值：ServiceVO
     */
    @PostMapping("/delete")
    public ServiceVO delete (Integer customerReturnListId){



        customerReturnService.delete(customerReturnListId);
        return new ServiceVO(SuccessCode.SUCCESS_CODE,SuccessCode.SUCCESS_MESS);

    }



}
